********************************************************************************
* Leipziger, L, Aarslew, L, & M. Christensen
* Replication Code for "Do Group-Based Inequalities Feel More Unjust?"
* POQ, 2026
* This code: Supplementary analyses (interactions)
********************************************************************************
********************************************************************************
clear all
frame rename default data
** Combining datasets 
use "data/IN_data_clean.dta", clear
append using "data/ZA_data_clean.dta"
append using "data/US_data_clean.dta"

lab define country_lab 1 "India" 2 "South Africa" 3 "US"
lab values country country_lab


*Household income

gen treat=0 if D==1
replace treat=1 if D==2

** Marginal effects (all)
qui reg fair_std i.treat##c.hh_income pretreat_fair if country==1, rob
mat A = r(table)

qui reg effort_std i.treat##c.hh_income pretreat_effort if country==1, rob
mat B = r(table)

qui reg angry i.treat##c.hh_income if country==1, rob
mat C = r(table)

reg frustrated i.treat##c.hh_income if country==1, rob
mat E = r(table)


* Matrix 
mat D = 1,1,A[1,5],A[5,5],A[6,5]\			/// 
		1,2,B[1,5],B[5,5],B[6,5]\			/// 
		1,3,C[1,5],C[5,5],C[6,5]\			///
		1,4,E[1,5],E[5,5],E[6,5]			


	
mat list D	


frame create plot1
cwf plot1		
svmat D
rename D1 treatment						// 1 = Interpersonal, 2 = Intergroup
rename D2 Xpos							// Position on X-axis
rename D3 b								// Parameter estimate (Marginal effect)
rename D4 ll							// lower confidence level
rename D5 ul							// upper confidence level


* Plot: 
tw ///
	(rspike ll ul Xpos if treatment == 1, lc("0 160 176")) ///
	(scatter b Xpos if treatment == 1, msym(O) mc("0 160 176") msize(med)) ///
	, yscale(range(-0.1 0.1) extend lc(none)) ytit("{bf:Interaction Coefficient} in India:" "Household income") ///
	yline(0) ylab(-0.1 -0.075 -0.05 -0.025 0 0.025 0.05 0.075 0.1, labsize(medsmall) gstyle(solid) glc(gs15%30) notick) ///
	xscale(range(.5 4.4) extend) xtit("{bf:Outcome}") ///
	xlab(1 "Distributive Fairness" 2 "Role of Effort" 3 "Feelings of Anger" 4 "Feelings of Frustration", gstyle(solid) labsize(vsmall) glc(gs15%30) notick) ///
	legend(off) ///
	plotregion(lcolor(black) lwidth(medium)) ///
	scale(1.3) graphregion(m(small)) ///
	name(dist_fair, replace)
	
graph display, xsize(12) ysize(9) 
graph export "output/figureSM6.pdf", as(pdf) replace
	
frame change data

** Marginal effects (all)
qui reg fair_std i.treat##c.hh_income pretreat_fair if country==2, rob
mat A = r(table)

qui reg effort_std i.treat##c.hh_income pretreat_effort if country==2, rob
mat B = r(table)

qui reg angry i.treat##c.hh_income if country==2, rob
mat C = r(table)

reg frustrated i.treat##c.hh_income if country==2, rob
mat E = r(table)


* Matrix 
mat D = 1,1,A[1,5],A[5,5],A[6,5]\			/// 
		1,2,B[1,5],B[5,5],B[6,5]\			/// 
		1,3,C[1,5],C[5,5],C[6,5]\			///
		1,4,E[1,5],E[5,5],E[6,5]			


	
mat list D	


frame create plot2
cwf plot2		
svmat D
rename D1 treatment						// 1 = Interpersonal, 2 = Intergroup
rename D2 Xpos							// Position on X-axis
rename D3 b								// Parameter estimate (Marginal effect)
rename D4 ll							// lower confidence level
rename D5 ul							// upper confidence level


* Plot: 
tw ///
	(rspike ll ul Xpos if treatment == 1, lc("0 160 176")) ///
	(scatter b Xpos if treatment == 1, msym(O) mc("0 160 176") msize(med)) ///
	, yscale(range(-0.1 0.1) extend lc(none)) ytit("{bf:Interaction Coefficient} in South Africa:" "Household income") ///
	yline(0) ylab(-0.1 -0.075 -0.05 -0.025 0 0.025 0.05 0.075 0.1, labsize(medsmall) gstyle(solid) glc(gs15%30) notick) ///
	xscale(range(.5 4.4) extend) xtit("{bf:Outcome}") ///
	xlab(1 "Distributive Fairness" 2 "Role of Effort" 3 "Feelings of Anger" 4 "Feelings of Frustration", gstyle(solid) labsize(vsmall) glc(gs15%30) notick) ///
	legend(off) ///
	plotregion(lcolor(black) lwidth(medium)) ///
	scale(1.3) graphregion(m(small)) ///
	name(dist_fair, replace)
	
graph display, xsize(12) ysize(9) 
graph export "output/figureSM7.pdf", as(pdf) replace

frame change data

** Marginal effects (all)
qui reg fair_std i.treat##c.hh_income pretreat_fair if country==3, rob
mat A = r(table)

qui reg effort_std i.treat##c.hh_income pretreat_effort if country==3, rob
mat B = r(table)

qui reg angry i.treat##c.hh_income if country==3, rob
mat C = r(table)

reg frustrated i.treat##c.hh_income if country==3, rob
mat E = r(table)


* Matrix 
mat D = 1,1,A[1,5],A[5,5],A[6,5]\			/// 
		1,2,B[1,5],B[5,5],B[6,5]\			/// 
		1,3,C[1,5],C[5,5],C[6,5]\			///
		1,4,E[1,5],E[5,5],E[6,5]			


	
mat list D	


frame create plot3
cwf plot3	
svmat D
rename D1 treatment						// 1 = Interpersonal, 2 = Intergroup
rename D2 Xpos							// Position on X-axis
rename D3 b								// Parameter estimate (Marginal effect)
rename D4 ll							// lower confidence level
rename D5 ul							// upper confidence level


* Plot: 
tw ///
	(rspike ll ul Xpos if treatment == 1, lc("0 160 176")) ///
	(scatter b Xpos if treatment == 1, msym(O) mc("0 160 176") msize(med)) ///
	, yscale(range(-0.1 0.1) extend lc(none)) ytit("{bf:Interaction Coefficient} in the US:" "Household income") ///
	yline(0) ylab(-0.1 -0.075 -0.05 -0.025 0 0.025 0.05 0.075 0.1, labsize(medsmall) gstyle(solid) glc(gs15%30) notick) ///
	xscale(range(.5 4.4) extend) xtit("{bf:Outcome}") ///
	xlab(1 "Distributive Fairness" 2 "Role of Effort" 3 "Feelings of Anger" 4 "Feelings of Frustration", gstyle(solid) labsize(vsmall) glc(gs15%30) notick) ///
	legend(off) ///
	plotregion(lcolor(black) lwidth(medium)) ///
	scale(1.3) graphregion(m(small)) ///
	name(dist_fair, replace)
	
	
graph display, xsize(12) ysize(9) 
graph export "output/figureSM8.pdf", as(pdf) replace


frame change data

*Self-perceived income placement
gen placement_income=q4/100
**not using within black and within white treatments

** Marginal effects (all)
qui reg fair_std i.treat##c.placement_income pretreat_fair i.country, rob
mat A = r(table)

qui reg effort_std i.treat##c.placement_income pretreat_effort i.country, rob
mat B = r(table)

qui reg angry i.treat##c.placement_income i.country, rob
mat C = r(table)

 reg frustrated i.treat##c.placement_income i.country, rob
mat E = r(table)


* Matrix 
mat D = 1,1,A[1,5],A[5,5],A[6,5]\			/// 
		1,2,B[1,5],B[5,5],B[6,5]\			/// 
		1,3,C[1,5],C[5,5],C[6,5]\			///
		1,4,E[1,5],E[5,5],E[6,5]

	
mat list D	


frame create plot4
cwf plot4
svmat D
rename D1 treatment						// 1 = Interpersonal, 2 = Intergroup
rename D2 Xpos							// Position on X-axis
rename D3 b								// Parameter estimate (Marginal effect)
rename D4 ll							// lower confidence level
rename D5 ul							// upper confidence level


* Plot: 
tw ///
	(rspike ll ul Xpos if treatment == 1, lc("0 160 176")) ///
	(scatter b Xpos if treatment == 1, msym(O) mc("0 160 176") msize(med)) ///
	, yscale(range(-0.3 1) extend lc(none)) ytit("{bf:Interaction Coefficient}:" "Self-Economic Placement") ///
	yline(0) ylab(-0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8, labsize(medsmall) gstyle(solid) glc(gs15%30) notick) ///
	xscale(range(.5 4.4) extend) xtit("{bf:Outcome}") ///
	xlab(1 "Distributive Fairness" 2 "Role of Effort" 3 "Feelings of Anger" 4 "Feelings of Frustration", gstyle(solid) labsize(vsmall) glc(gs15%30) notick) ///
	legend(off) ///
	plotregion(lcolor(black) lwidth(medium)) ///
	scale(1.3) graphregion(m(small)) ///
	name(dist_fair, replace)
	
graph display, xsize(12) ysize(9) 
graph export "output/figureSM17.pdf", as(pdf) replace
	
*** Fig A9-A16: Interaction Race Identification
** Combining datasets 
use "data/IN_data_clean.dta", clear
append using "data/ZA_data_clean.dta"
append using "data/US_data_clean.dta"

lab define country_lab 1 "India" 2 "South Africa" 3 "US"
lab values country country_lab

**not using within black and within white treatments

gen treat=0 if D==1
replace treat=1 if D==2

** Marginal effects (all) - Race Identity
interflex fair_std treat RC_1 pretreat_fair,  vce(robust) fe(country)  saving(output/figureSM9)

interflex effort_std treat RC_1 pretreat_effort,  vce(robust) fe(country)  saving(output/figureSM10)

interflex angry treat RC_1 ,  vce(robust) fe(country)  saving(output/figureSM11)

interflex frustrated treat RC_1,  vce(robust) fe(country)  saving(output/figureSM12)

** Marginal effects (all) - SDO scale 1
interflex fair_std treat SDO_1 pretreat_fair,  vce(robust) fe(country)  saving(output/figureSM13)

interflex effort_std treat SDO_1 pretreat_effort,  vce(robust) fe(country)  saving(output/figureSM14)

interflex angry treat SDO_1,  vce(robust) fe(country)  saving(output/figureSM15)

interflex frustrated treat SDO_1,  vce(robust) fe(country)  saving(output/figureSM16)

** Marginal effects (all) - SDO scale 2 - NOT REPORTED IN SUPPLEMENTARY ANALYSES
interflex fair_std treat SDO_2 pretreat_fair,  vce(robust) fe(country)  saving(output/fairness_SDO_2)

interflex effort_std treat SDO_2 pretreat_effort,  vce(robust) fe(country)  saving(output/effort_SDO_2)

interflex angry treat SDO_2,  vce(robust) fe(country)  saving(output/angry_SDO_2)

interflex frustrated treat SDO_2,  vce(robust) fe(country)  saving(output/frustrate_SDO_2)



	

	
	